//
//  HomeTableViewCell.m
//  hostView
//
//  Created by 徐宏飞 on 16/5/19.
//  Copyright © 2016年 徐宏飞. All rights reserved.
//

#import "HomeTableViewCell.h"
#import "HomeListModel.h"




@interface HomeTableViewCell ()

@property (weak, nonatomic) IBOutlet UIImageView *imgWorker_avatar;     //头像
@property (weak, nonatomic) IBOutlet UILabel *lblType_name;             //工种
@property (weak, nonatomic) IBOutlet UILabel *lblPrice;                 //价格
@property (weak, nonatomic) IBOutlet UILabel *lblWorker_name;           //工人姓名
@property (weak, nonatomic) IBOutlet UILabel *lblWorkTime;              //起止时间
@property (weak, nonatomic) IBOutlet UILabel *lblPublish_time;          //发布时间
@property (weak, nonatomic) IBOutlet UILabel *lblStatus;                //项目状态



@end


@implementation HomeTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}





- (void)setModel:(HomeListModel *)model{
    _model = model;
    
    //头像
    NSString *str = [NSString stringWithFormat:@"%@%@", _model.worker_avatar, avatarcase];
    NSURL *url = [NSURL URLWithString:str];
    [self.imgWorker_avatar sd_setImageWithURL:url placeholderImage:AVATARPLACEHOLDER];
    
    //工种
    self.lblType_name.text = model.type_name;
    //价格
    self.lblPrice.text = [NSString stringWithFormat:@"%@ 元/平方", _model.price];
    //姓名
    self.lblWorker_name.text = [NSString stringWithFormat:@"施工人:%@", _model.worker_name];
    //起止时间
    self.lblWorkTime.text = [NSString stringWithFormat:@"时间:%@至%@", [NSString getBeijingDayWithStrTime:_model.start_time], [NSString getBeijingDayWithStrTime:_model.end_time]];
    //发布时间
    self.lblPublish_time.text = [NSString stringWithFormat:@"%@发布", [NSString getBeijingDayWithStrTime:_model.publish_time]];
    //状态
    if ([_model.status isEqualToString:@"finished"]) {
        
        self.lblStatus.text = @"已完工";
        self.lblStatus.textColor = COLOR_THEHE;
    } else {
        self.lblStatus.text = @"正在进行中";
        self.lblStatus.textColor = [UIColor orangeColor];
        
    }

}














- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
